﻿Imports System.Windows.Forms

Public Class MDI
    Dim Var As New varDeclare
    Dim frmCtrl As New FormControl
    Dim dbSys As New dbSystem
    Public dsModule As DataSet
    Public dsPermission As DataSet
    Public LoginID As String
    Public LoginUserName As String

    Private Sub ExitToolsStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ExitToolStripMenuItem.Click
        Me.Close()
    End Sub

    Private m_ChildFormNumber As Integer

    Private Sub MDI_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        tsBaseCurr.Text += dbSys.FreeQueryString("SELECT TOP 1 CURR_BASE FROM CURRENCIES WITH(NOLOCK)")
        tsCompID.Text = "Comp : " + Var.CompID
        dsModule = dbSys.GetAllModuleList()
        Me.WindowState = FormWindowState.Maximized
        frmCtrl.openChild(New frmSSLogin, Me)
        Dim GenPeriod As String = dbSys.GeneratePostingPeriod()
        If (GenPeriod <> "0") Then
            MessageBox.Show("Success Generate " & GenPeriod & " Posting Period")
        End If
        Dim GenGLBalance As String = dbSys.GenerateMissingGLBalance()
        If (GenGLBalance <> "Success") Then
            MessageBox.Show(GenGLBalance)
        End If
    End Sub

    Private Sub UserToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MenuItemUserManagement.Click
        frmCtrl.openChild(New frmUser, Me)
    End Sub

    Private Sub tsViewStatusBar_Click(sender As Object, e As EventArgs) Handles tsViewStatusBar.Click
        Me.tsSystem.Visible = Me.tsViewStatusBar.Checked
    End Sub

    Private Sub tsLogOut_Click(sender As Object, e As EventArgs) Handles tsLogOut.Click
        Me.LoginID = ""
        Me.LoginUserName = ""
        frmCtrl.openChild(New frmSSLogin, Me)
    End Sub

    Private Sub FormulaToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MenuItemFormula.Click
        frmCtrl.openChild(New frmListFormula, Me)
    End Sub

    Private Sub SalesOrderToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MenuItemSO.Click
        frmCtrl.openChild(New frmARSalesOrderList, Me)
    End Sub

    Private Sub UserPermissionToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MenuItemUserPermission.Click
        frmCtrl.openChild(New frmUserPermission, Me)
    End Sub

    Private Sub DeliveryOrderToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MenuItemDO.Click
        frmCtrl.openChild(New frmARDeliveryOrder, Me)
    End Sub

    Private Sub JournalToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles JournalToolStripMenuItem.Click
        Dim frmReport As New frmGenerateReport
        frmReport.Initialize("Journal Report", "Journal")
        frmReport.Show()
    End Sub

    Private Sub CustomerListToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MenuItemCustomerList.Click
        frmCtrl.openChild(New frmCustomerList, Me)
    End Sub

    Private Sub PrincipleListToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MenuItemPrincipleList.Click
        frmCtrl.openChild(New frmMasterPrincipal, Me)
    End Sub

    Private Sub ProductionPriceListToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MenuItemProductionPriceList.Click
        frmCtrl.openChild(New frmProductionPriceStockList, Me)
    End Sub

    Private Sub StockListToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MenuItemStockList.Click
        frmCtrl.openChild(New frmStockList, Me)
    End Sub

    Private Sub ChangePasswordToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles tsChangePassword.Click
        frmCtrl.openChild(New frmChangePassword, Me)
    End Sub

    Private Sub PriceCalculationToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MenuItemPriceCalculation.Click
        frmCtrl.openChild(New frmPriceCalcList, Me)
    End Sub

    Private Sub MenuItemCOA_Click(sender As Object, e As EventArgs) Handles MenuItemCOA.Click
        frmCtrl.openChild(New frmCharOfAccount, Me)
    End Sub

    Private Sub MenuItemGeneralLedger_Click(sender As Object, e As EventArgs) Handles MenuItemGeneralLedger.Click
        frmCtrl.openChild(New frmGLGeneralLedger, Me)
    End Sub

    Private Sub MenuItemFormulaProductionList_Click(sender As Object, e As EventArgs) Handles MenuItemFormulaProductionList.Click

    End Sub

    Private Sub MenuItemQuotation_Click(sender As Object, e As EventArgs) Handles MenuItemQuotation.Click
        frmCtrl.openChild(New frmQuotationList, Me)
    End Sub

    Private Sub MenuItemSampleRequest_Click(sender As Object, e As EventArgs) Handles MenuItemSampleRequest.Click
        frmCtrl.openChild(New frmSampleRequestList, Me)
    End Sub

    Private Sub MenuItemSalesReturn_Click(sender As Object, e As EventArgs) Handles MenuItemSalesReturn.Click
        frmCtrl.openChild(New frmSalesReturnList, Me)
    End Sub

    Private Sub MenuItemRequest_Click(sender As Object, e As EventArgs) Handles MenuItemRequest.Click

    End Sub

    Private Sub MenuItemCustomerAccount_Click(sender As Object, e As EventArgs) Handles MenuItemCustomerAccount.Click
        frmCtrl.openChild(New frmCustomerAccount, Me)
    End Sub

    Private Sub MenuItemItemCode_Click(sender As Object, e As EventArgs) Handles MenuItemItemCode.Click
        frmCtrl.openChild(New frmMasterItemCode, Me)
    End Sub

    Private Sub MenuItemGroupItem_Click(sender As Object, e As EventArgs) Handles MenuItemGroupItem.Click
        frmCtrl.openChild(New frmMasterGroupItem, Me)
    End Sub

    Private Sub MenuItemTypeOfStock_Click(sender As Object, e As EventArgs) Handles MenuItemTypeOfStock.Click
        frmCtrl.openChild(New frmMasterItemTypeStock, Me)
    End Sub
End Class
